# coding: gbk
import os
DEL = ['initGSA','datasvr','RMAtool','SDSsvr','csmond','GAPSXlauchd']
def del_log(ph):
    print "rm -f %s/ErrLog*"%ph
    os.system("rm -f %s/ErrLog*"%ph)
    print "rm -f %s/httpsrvd*"%ph
    os.system("rm -f %s/httpsrvd*"%ph)
    print "rm -r %s/hsxp/*"%ph
    os.system("rm -r %s/hsxp/*"%ph)
    if os.path.exists(ph):
        for path, dirs, files in os.walk( ph ):
            for file in files:
                if 'SDSsvr_DEBUG' in file:
                    continue
                elif file.split('_')[0].split('.')[0] in DEL:
                    print "rm -f %s/%s"%(path,file)
                    os.system("rm -f %s/%s"%(path,file))
ph='%s/log'%(os.environ.get('HOME'))
del_log(ph)

import paramiko

ssh = paramiko.SSHClient()
key = paramiko.AutoAddPolicy()
ssh.set_missing_host_key_policy(key)
ssh.connect('10.3.8.15', 22, 'appoper', 'q1w2E#R$' ,timeout=5)
stdin, stdout, stderr = ssh.exec_command('ls')

for i in stdout.readlines():
    print(i)